package udpdemo3;

import java.io.IOException;
import java.net.*;

/**
 * Created by L.jp
 * Description:
 * User: 86189
 * Date: 2022-08-09
 * Time: 0:17
 */
public class ClientDemo {
    public static void main(String[] args) throws IOException {
        DatagramSocket socket=new DatagramSocket();
    
        String data="你好组播";
        byte[] bytes=data.getBytes();
        InetAddress address=InetAddress.getByName("224.0.1.2");
        int port=1000;
        DatagramPacket packet=new DatagramPacket(bytes, bytes.length,address,port);
        socket.send(packet);
        socket.close();
    
    }
}
